import qs from 'qs'

export default $axios => ({
    getItemListByProductId(productId) {
        return $axios.get('/server/item', {
            params: {
                type: 'productId',
                id: productId
            }
        })
    },
    getItemByItemId(itemId) {
        return $axios.get('/server/item', {
            params: {
                type: 'itemId',
                id: itemId
            }
        })
    },
    updateQuantity(itemId, quantity) {
        return $axios.put('/server/item/quantity', qs.stringify({
            itemId,
            quantity
        }))
    }
})